import sys

import tkinter as tk
from tkinter import ttk
import threading

import os, io, json, subprocess, tempfile
from urllib import parse
from wsgiref.simple_server import make_server, WSGIRequestHandler


# now we create GUI
root = tk.Tk()
root.title('编玩边学Python助手')


def quit1(evt):
    print("quit:")
    print(evt)

def pressE(evt):
    print("Press CMD+E")

# root.bind('<Command-q>', quit1)
root.bind('<Command-e>', pressE)
root.bind('Quit', quit1)

def quit2():
    print("closing in quit2")

root.protocol('WM_DELETE_WINDOW', quit2)
root.createcommand('tk::mac::Quit', quit2)


text = tk.Text(root, width=100, height=30)
text.pack(padx=5, pady=2)


if __name__ == '__main__':
    tk.mainloop()
